#!/bin/bash
# 启动 Gateway V3（微服务版）

set -e

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BIN="$ROOT/bin/gateway_v3"

echo "========================================="
echo "  启动 Gateway V3"
echo "========================================="

if [ ! -x "$BIN" ]; then
  echo "未找到可执行文件: $BIN"
  echo "请先编译: make gateway_v3"
  exit 1
fi

if ! redis-cli ping >/dev/null 2>&1; then
  echo "Redis 未运行，请先启动: redis-server --daemonize yes"
  exit 1
fi

"$BIN"

